package com.xinqi.modules.homework.homework.job;

import com.xinqi.common.base.utils.uuids.UUIDs;
import com.xinqi.modules.homework.homework.service.CourseHomeworkService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class HomeworkJob {
    private final CourseHomeworkService courseHomeworkService;

    /**
     * 作业定时发布
     */
    @XxlJob("homeworkStatusHandler")
    public ReturnT<String> homeworkStatusHandler() throws Exception {
        String uid = UUIDs.uuidStr();
        log.debug("job executor! {}, 作业定时发布-开始", uid);
        courseHomeworkService.homeworkTiming();
        log.debug("job executor! {}, 作业定时发布-结束", uid);
        return ReturnT.SUCCESS;
    }

}
